import { atom } from 'jotai';


export interface Document {
  id: string,
  title: string,
  ownerId: string,
  createdAt: string,
  updatedAt: string,
  isOwner: boolean
}

export const documentsListAtom = atom<Document[]>([]);


export const currentDocumentAtom = atom<Document | null>(null);


export const setDocumentsListAtom = atom(null, (get, set, documents: Document[]) => {
  set(documentsListAtom, documents);
});


export const setCurrentDocumentAtom = atom(null, (get, set, document: Document | null) => {
  set(currentDocumentAtom, document);
});



